package com.songlanyun.modules.payorder.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.songlanyun.common.utils.PageUtils;
import com.songlanyun.modules.payorder.dao.PayOrderDao;
import com.songlanyun.modules.payorder.dao.SaleOrderReductionRecordDao;
import com.songlanyun.modules.payorder.entity.PayOrder;
import com.songlanyun.modules.payorder.entity.SaleOrderReductionRecord;
import com.songlanyun.modules.payorder.service.PayOrderService;
import com.songlanyun.modules.payorder.service.SaleOrderReductionRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;

@Service
public class SaleOrderReductionRecordServiceImpl extends ServiceImpl<SaleOrderReductionRecordDao, SaleOrderReductionRecord> implements SaleOrderReductionRecordService {



    @Autowired
    private SaleOrderReductionRecordDao saleOrderReductionRecordDao;

    @Override
    public SaleOrderReductionRecord create(SaleOrderReductionRecord entity) {
        return null;
    }

    @Override
    public SaleOrderReductionRecord modify(SaleOrderReductionRecord entity) {
        return null;
    }

    @Override
    public void remove(Long id) {

    }

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        return null;
    }


    @Override
    public void createSaleOrderReductionRecord(PayOrder payOrder, BigDecimal randomDecimal, BigDecimal totalAmount) {
        SaleOrderReductionRecord saleOrderReductionRecord = new SaleOrderReductionRecord();
        saleOrderReductionRecord.setPayCode(payOrder.getCode());
        saleOrderReductionRecord.setUserId(payOrder.getUserId());
        saleOrderReductionRecord.setReductionMoney(randomDecimal);
        saleOrderReductionRecord.setTotalAmountReduction(totalAmount);
        saleOrderReductionRecord.setCreateTime(new Date());
        saleOrderReductionRecordDao.insert(saleOrderReductionRecord);
    }
}
